Skip to content

FIX cupy.is_in_gpu for numpy >= 2.0 - #99

Merged
mvdoc merged 1 commit into
gallantlab:mainfrom
kroq-gar78:fix-cupy-is-gpu
Jun 8, 2026
Merged

FIX cupy.is_in_gpu for numpy >= 2.0#99
mvdoc merged 1 commit into
gallantlab:mainfrom
kroq-gar78:fix-cupy-is-gpu

Conversation

@kroq-gar78

Copy link
Copy Markdown
Contributor

All tests in himalaya/kernel_ridge/tests/test_force_cpu.py were failing for the cupy backend when force_cpu=True.

NumPy 2.0 added compliance with the Array API, which means a .device property for all ndarrays that's always equal to 'cpu'. Previously, himalaya assumed that the property did not exist when checking the device. I tested this PR locally, and it works for both NumPy >=2.0 and 1.26.4 (the last pre-2.0 release).

@kroq-gar78
kroq-gar78 marked this pull request as ready for review April 12, 2026 22:16
@kroq-gar78 kroq-gar78 changed the title FIX cupy.is_in_gpu for newer numpy versions FIX cupy.is_in_gpu for numpy >= 2.0 Apr 12, 2026
@mvdoc
mvdoc merged commit 084ad51 into gallantlab:main Jun 8, 2026
8 checks passed
@kroq-gar78
kroq-gar78 deleted the fix-cupy-is-gpu branch June 11, 2026 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants